package com.example.train_operate.config;//
// Source code recreated from a .class file by IntelliJ IDEA
// (powered by FernFlower decompiler)
//

import com.example.train_operate.util.Result;
import com.example.train_operate.util.ResultCodeEnum;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.web.bind.annotation.ExceptionHandler;
import org.springframework.web.bind.annotation.RestControllerAdvice;

@RestControllerAdvice
public class WebExceptionAdvice {
    private static final Logger log = LoggerFactory.getLogger(WebExceptionAdvice.class);

    public WebExceptionAdvice() {
    }

    @ExceptionHandler({RuntimeException.class})
    public Result handleRuntimeException(RuntimeException e) {
        log.error("运行时异常：----------------{}", e.getMessage(), e);
        return Result.fail(null, ResultCodeEnum.SERVICE_ERROR);
    }
}